﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditFund2.aspx.cs" Inherits="FundRaising.GUI.EditFund2" MasterPageFile="~/GUI/FundRaisingMasterPage.Master" %>

<asp:Content ID="Content1" runat="server" 
    contentplaceholderid="ContentPlaceHolder1">
    <div>
        <table align="center" style="width: 780px;" bgcolor="White">
            <tr>
                <td valign="top">
                <div style="background-image: url('pic/searchbg.png'); background-repeat: no-repeat; height: 42px;" 
                        dir="rtl"> 
                        <div style="float: right; width: 30px; height: 48px;"></div>
<div style="float: right; height: 33px; width: 732px; padding-top:5px; ">
    שם הקרן:&nbsp;&nbsp;&nbsp;<asp:DropDownList ID="DropDownList1" runat="server" 
        DataSourceID="SqlDataSource1" DataTextField="FundName" 
        DataValueField="FundName" Height="22px" Width="134px" AutoPostBack="True">
    </asp:DropDownList>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <span style="font-family: David; font-size: x-large; color: #993300">&nbsp; ניהול קרנות</span><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
        SelectCommand="SELECT DISTINCT [FundName] FROM [Fund2]"></asp:SqlDataSource>
&nbsp;
  </div>
 
                    
                    </div>
                <div style="height: 9px" dir="rtl">
                
                </div>
                <div style="background-image: url('pic/7.png'); background-repeat: no-repeat; height: 337px;" 
                        dir="rtl">
                     <div style="float: right; width: 33px; height: 145px;"></div>
                      <div style="float: right; height: 319px; width: 737px;">
                      &nbsp<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                              DataKeyNames="FundName" DataSourceID="SqlDataSource2" Height="49px" 
                              Width="336px" CellPadding="2" ForeColor="Black" GridLines="None" 
                              BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" 
                              onitemdeleted="DetailsView1_ItemDeleted" 
                              oniteminserted="DetailsView1_ItemInserted">
                              <FooterStyle BackColor="Tan" />
                              <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
                                  HorizontalAlign="Center" />
                              <Fields>
                                  <asp:BoundField DataField="FundName" HeaderText="שם הקרן" ReadOnly="True" 
                                      SortExpression="FundName" />
                                  <asp:BoundField DataField="FundStatus" HeaderText="סטטוס" 
                                      SortExpression="FundStatus" />
                                  <asp:BoundField DataField="NameContact" HeaderText="איש קשר" 
                                      SortExpression="NameContact" />
                                  <asp:BoundField DataField="PhoneNum" HeaderText="טלפון" 
                                      SortExpression="PhoneNum" />
                                  <asp:BoundField DataField="FaxNum" HeaderText="פקס" 
                                      SortExpression="FaxNum" />
                                  <asp:BoundField DataField="Email" HeaderText="דו&quot;אל" 
                                      SortExpression="Email" />
                                  <asp:BoundField DataField="SiteLink" HeaderText="קישור לאתר" 
                                      SortExpression="SiteLink" />
                                  <asp:BoundField DataField="Address" HeaderText="כתובת מכתבים" 
                                      SortExpression="Address" />
                                  <asp:BoundField DataField="DeadLine" HeaderText="דד-ליין" 
                                      SortExpression="DeadLine" />
                                  <asp:BoundField DataField="CountryOfOrigin" HeaderText="ארץ" 
                                      SortExpression="CountryOfOrigin" />
                                  <asp:TemplateField ShowHeader="False">
                                      <EditItemTemplate>
                                          <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                              CommandName="Update" Text="עדכן" 
                                              onclientclick="alert('עדכון התבצע בהצלחה')"></asp:LinkButton>
                                          &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                              CommandName="Cancel" Text="בטל" 
                                              onclientclick="return confirm('אזהרה : כל שינוי שנעשה לא ישמר');"></asp:LinkButton>
                                      </EditItemTemplate>
                                      <InsertItemTemplate>
                                          <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                              CommandName="Insert" Text="הכנס"></asp:LinkButton>
                                          &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                              CommandName="Cancel" Text="בטל"></asp:LinkButton>
                                      </InsertItemTemplate>
                                      <ItemTemplate>
                                          <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                              CommandName="Edit" Text="ערוך"></asp:LinkButton>
                                          &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                              CommandName="New" Text="חדש"></asp:LinkButton>
                                          &nbsp;<asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" 
                                              CommandName="Delete" OnClientClick="return confirm('נא אשר מחיקה');"  Text="מחק"></asp:LinkButton>
                                      </ItemTemplate>
                                  </asp:TemplateField>
                              </Fields>
                              <HeaderStyle BackColor="Tan" Font-Bold="True" />
                              <EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                              <AlternatingRowStyle BackColor="PaleGoldenrod" />
                          </asp:DetailsView>
                          <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                              ConflictDetection="CompareAllValues" 
                              ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
                              DeleteCommand="DELETE FROM [Fund2] WHERE [FundName] = @original_FundName AND (([FundStatus] = @original_FundStatus) OR ([FundStatus] IS NULL AND @original_FundStatus IS NULL)) AND (([NameContact] = @original_NameContact) OR ([NameContact] IS NULL AND @original_NameContact IS NULL)) AND (([PhoneNum] = @original_PhoneNum) OR ([PhoneNum] IS NULL AND @original_PhoneNum IS NULL)) AND (([FaxNum] = @original_FaxNum) OR ([FaxNum] IS NULL AND @original_FaxNum IS NULL)) AND (([Email] = @original_Email) OR ([Email] IS NULL AND @original_Email IS NULL)) AND (([SiteLink] = @original_SiteLink) OR ([SiteLink] IS NULL AND @original_SiteLink IS NULL)) AND (([Address] = @original_Address) OR ([Address] IS NULL AND @original_Address IS NULL)) AND (([DeadLine] = @original_DeadLine) OR ([DeadLine] IS NULL AND @original_DeadLine IS NULL)) AND (([CountryOfOrigin] = @original_CountryOfOrigin) OR ([CountryOfOrigin] IS NULL AND @original_CountryOfOrigin IS NULL))" 
                              InsertCommand="INSERT INTO [Fund2] ([FundName], [FundStatus], [NameContact], [PhoneNum], [FaxNum], [Email], [SiteLink], [Address], [DeadLine], [CountryOfOrigin]) VALUES (@FundName, @FundStatus, @NameContact, @PhoneNum, @FaxNum, @Email, @SiteLink, @Address, @DeadLine, @CountryOfOrigin)" 
                              OldValuesParameterFormatString="original_{0}" 
                              SelectCommand="SELECT * FROM [Fund2] WHERE ([FundName] = @FundName)" 
                              UpdateCommand="UPDATE [Fund2] SET [FundStatus] = @FundStatus, [NameContact] = @NameContact, [PhoneNum] = @PhoneNum, [FaxNum] = @FaxNum, [Email] = @Email, [SiteLink] = @SiteLink, [Address] = @Address, [DeadLine] = @DeadLine, [CountryOfOrigin] = @CountryOfOrigin WHERE [FundName] = @original_FundName AND (([FundStatus] = @original_FundStatus) OR ([FundStatus] IS NULL AND @original_FundStatus IS NULL)) AND (([NameContact] = @original_NameContact) OR ([NameContact] IS NULL AND @original_NameContact IS NULL)) AND (([PhoneNum] = @original_PhoneNum) OR ([PhoneNum] IS NULL AND @original_PhoneNum IS NULL)) AND (([FaxNum] = @original_FaxNum) OR ([FaxNum] IS NULL AND @original_FaxNum IS NULL)) AND (([Email] = @original_Email) OR ([Email] IS NULL AND @original_Email IS NULL)) AND (([SiteLink] = @original_SiteLink) OR ([SiteLink] IS NULL AND @original_SiteLink IS NULL)) AND (([Address] = @original_Address) OR ([Address] IS NULL AND @original_Address IS NULL)) AND (([DeadLine] = @original_DeadLine) OR ([DeadLine] IS NULL AND @original_DeadLine IS NULL)) AND (([CountryOfOrigin] = @original_CountryOfOrigin) OR ([CountryOfOrigin] IS NULL AND @original_CountryOfOrigin IS NULL))">
                              <SelectParameters>
                                  <asp:ControlParameter ControlID="DropDownList1" Name="FundName" 
                                      PropertyName="SelectedValue" Type="String" />
                              </SelectParameters>
                              <DeleteParameters>
                                  <asp:Parameter Name="original_FundName" Type="String" />
                                  <asp:Parameter Name="original_FundStatus" Type="String" />
                                  <asp:Parameter Name="original_NameContact" Type="String" />
                                  <asp:Parameter Name="original_PhoneNum" Type="String" />
                                  <asp:Parameter Name="original_FaxNum" Type="String" />
                                  <asp:Parameter Name="original_Email" Type="String" />
                                  <asp:Parameter Name="original_SiteLink" Type="String" />
                                  <asp:Parameter Name="original_Address" Type="String" />
                                  <asp:Parameter Name="original_DeadLine" Type="String" />
                                  <asp:Parameter Name="original_CountryOfOrigin" Type="String" />
                              </DeleteParameters>
                              <UpdateParameters>
                                  <asp:Parameter Name="FundStatus" Type="String" />
                                  <asp:Parameter Name="NameContact" Type="String" />
                                  <asp:Parameter Name="PhoneNum" Type="String" />
                                  <asp:Parameter Name="FaxNum" Type="String" />
                                  <asp:Parameter Name="Email" Type="String" />
                                  <asp:Parameter Name="SiteLink" Type="String" />
                                  <asp:Parameter Name="Address" Type="String" />
                                  <asp:Parameter Name="DeadLine" Type="String" />
                                  <asp:Parameter Name="CountryOfOrigin" Type="String" />
                                  <asp:Parameter Name="original_FundName" Type="String" />
                                  <asp:Parameter Name="original_FundStatus" Type="String" />
                                  <asp:Parameter Name="original_NameContact" Type="String" />
                                  <asp:Parameter Name="original_PhoneNum" Type="String" />
                                  <asp:Parameter Name="original_FaxNum" Type="String" />
                                  <asp:Parameter Name="original_Email" Type="String" />
                                  <asp:Parameter Name="original_SiteLink" Type="String" />
                                  <asp:Parameter Name="original_Address" Type="String" />
                                  <asp:Parameter Name="original_DeadLine" Type="String" />
                                  <asp:Parameter Name="original_CountryOfOrigin" Type="String" />
                              </UpdateParameters>
                              <InsertParameters>
                                  <asp:Parameter Name="FundName" Type="String" />
                                  <asp:Parameter Name="FundStatus" Type="String" />
                                  <asp:Parameter Name="NameContact" Type="String" />
                                  <asp:Parameter Name="PhoneNum" Type="String" />
                                  <asp:Parameter Name="FaxNum" Type="String" />
                                  <asp:Parameter Name="Email" Type="String" />
                                  <asp:Parameter Name="SiteLink" Type="String" />
                                  <asp:Parameter Name="Address" Type="String" />
                                  <asp:Parameter Name="DeadLine" Type="String" />
                                  <asp:Parameter Name="CountryOfOrigin" Type="String" />
                              </InsertParameters>
                          </asp:SqlDataSource>
                          &nbsp;
                          
                     </div>
                    </div>
                
                <div style="background-image: url('pic/NewMainWindow/MainWindow6.png'); background-repeat: no-repeat; height: 236px;">
         <div style="float: right; width: 33px; height: 235px;"></div>
                <div style="height: 250px; height:584px;" 
                        align="right" dir="rtl">
                    
                &nbsp<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AllowSorting="True" AutoGenerateColumns="False" CellPadding="2" 
                        DataKeyNames="SerialNum" DataSourceID="ObjectDataSource1" ForeColor="Black" 
                        GridLines="None" PageSize="4" Width="228px" 
                        BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px">
                        <Columns>
                            <asp:TemplateField ShowHeader="False">
                                <EditItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                                        CommandName="Update" Text="עדכן" 
                                        onclientclick="alert('עדכון התבצע בהצלחה')"></asp:LinkButton>
                                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                        CommandName="Cancel" Text="בטל" 
                                        OnClientClick="return confirm('אזהרה : כל שינוי שנעשה לא ישמר');"></asp:LinkButton>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                        CommandName="Edit" Text="ערוך"></asp:LinkButton>
                                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                        CommandName="Delete"  OnClientClick="return confirm('נא אשר מחיקה');"  Text="מחק"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="SerialNum" HeaderText="SerialNum" ReadOnly="True" 
                                SortExpression="SerialNum" Visible="False" />
                            <asp:TemplateField HeaderText="תחום פעילות" SortExpression="DomainName">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("DomainName") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:DropDownList ID="DropDownList2" runat="server" 
                                        DataSourceID="SqlDataSource1" DataTextField="DomainName" 
                                        DataValueField="DomainName" Height="23px" 
                                        SelectedValue='<%# Bind("DomainName") %>' Width="134px">
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
                                        SelectCommand="SELECT DISTINCT [DomainName] FROM [Domain]">
                                    </asp:SqlDataSource>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="FundName" HeaderText="FundName" 
                                SortExpression="FundName" Visible="False" />
                        </Columns>
                        <FooterStyle BackColor="Tan" />
                        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" 
                            HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                        <HeaderStyle BackColor="Tan" Font-Bold="True" />
                        <AlternatingRowStyle BackColor="PaleGoldenrod" />
                    </asp:GridView>
                 
                    
                    
                    
                    <asp:ListView ID="ListView1" runat="server" DataKeyNames="SerialNum" 
                        DataSourceID="ObjectDataSource1" InsertItemPosition="LastItem" 
                        oniteminserting="ListView1_ItemInserting" 
                        onitemdatabound="ListView1_ItemDataBound">
                        <ItemTemplate>
                            <tr style="background-color:#DCDCDC;color: #000000;">
                               
                                
                            </tr>
                        </ItemTemplate>
                        <AlternatingItemTemplate>
                            <tr style="background-color:#FFF8DC;">
                               
                            </tr>
                        </AlternatingItemTemplate>
                        <EmptyDataTemplate>
                            <table runat="server" 
                                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                                <tr>
                                    <td>
                                        No data was returned.</td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        <InsertItemTemplate>
                            <tr  style="" dir="rtl">
                                <td>
                                    &nbsp &nbsp
                                    <asp:Button ID="InsertButton" runat="server" CommandName="insert" 
                                        Text="הכנס" OnClientClick="alert('הוספת נתון חדש התבצעה בהצלחה ');" />
                                    </td>
                              
                                <td> 
                                     
                                        <asp:DropDownList ID="DDL" runat="server" DataSourceID="SqlDataSource3" 
                        DataTextField="DomainName" DataValueField="DomainName"  Height="22px" Width="144px" >
                 </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
                        SelectCommand="SELECT [DomainName] FROM [Domain]"></asp:SqlDataSource>
                                </td>
                               
                            </tr>
                        </InsertItemTemplate>
                        <LayoutTemplate>
                            <table runat="server">
                                <tr runat="server">
                                    <td runat="server">
                                        <table ID="itemPlaceholderContainer" runat="server" border="1" 
                                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                            <tr runat="server" style="background-color:#DCDCDC;color: #000000;">
                                                <th runat="server">
                                                </th>
                                        
                                                
                                            
                                            </tr>
                                            <tr ID="itemPlaceholder" runat="server">
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr runat="server">
                                    <td runat="server" 
                                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                                        <asp:DataPager ID="DataPager1" runat="server">
                                            
                                        </asp:DataPager>
                                    </td>
                                </tr>
                            </table>
                        </LayoutTemplate>
                        <EditItemTemplate>
                            <tr style="background-color:#008A8C;color: #FFFFFF;">
                                <td>
                                    
                                </td>
                                
                                <td>
                                    <asp:DropDownList ID="DDL1" runat="server" DataSourceID="SqlDataSource3" 
                        DataTextField="DomainName" DataValueField="DomainName" Text='<% #Bind("DomainName")%>' ValidationGroup="add" >
                 </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:Eden-DatabaseConnectionString3 %>" 
                        SelectCommand="SELECT [DomainName] FROM [Domain]"></asp:SqlDataSource>
                                </td>
                                
                            </tr>
                        </EditItemTemplate>
                        <SelectedItemTemplate>
                            <tr style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
                                <td>
                                    <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                                </td>
                                
                                <td>
                                    <asp:Label ID="DomainNameLabel" runat="server" 
                                        Text='<%# Eval("DomainName") %>' />
                                </td>
                                
                            </tr>
                        </SelectedItemTemplate>
                    </asp:ListView>
                       <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                        InsertMethod="InsertDomFund" SelectMethod="GetDomainByFund" 
                        TypeName="FundRaising.BLL.DomainFundBLL" UpdateMethod="UpdateDomFund" 
                        DeleteMethod="DeleteDomFund">
                        <DeleteParameters>
                            <asp:Parameter Name="DomainName" Type="String" />
                            <asp:Parameter DbType="Guid" Name="Original_SerialNum" />
                            <asp:Parameter DbType="Guid" Name="SerialNum" />
                        </DeleteParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="DomainName" Type="String" />
                            <asp:Parameter DbType="Guid" Name="Original_SerialNum" />
                            <asp:Parameter DbType="Guid" Name="SerialNum" />
                        </UpdateParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="DropDownList1" Name="FundName" 
                                PropertyName="SelectedValue" Type="String" />
                        </SelectParameters>
                        <InsertParameters>
                            <asp:Parameter Name="SerialNum" Type="String" />
                            <asp:Parameter Name="DomainName" Type="String" />
                            <asp:Parameter Name="FundName" Type="String" />
                        </InsertParameters>
                    </asp:ObjectDataSource>
                    </div>
                </div>
                
                
                
                </td>
                </tr>
         </table>
    </div>
        
                             

</asp:Content>